//
//  TestRecordTableViewCell.swift
//  DriverSchoolAPP
//
//  Created by Logel on 2017/6/8.
//  Copyright © 2017年 Logel. All rights reserved.
//

import UIKit

class TestRecordTableViewCell: UITableViewCell {
    @IBOutlet weak var indexLbl: UILabel!
    @IBOutlet weak var timeLbp: UILabel!
    @IBOutlet weak var SJCLbl: UILabel!
    @IBOutlet weak var rotal: UILabel!
    @IBOutlet weak var okLbl: UILabel!
    @IBOutlet weak var errLbl: UILabel!
    var indexNum = 0
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    var tr:TestRecord!{
        didSet{
            indexLbl.text = "记录\(indexNum+1)"
            timeLbp.text = "\(tr.createTime)"
            let dateFormatter = DateFormatter()
            dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
            let timeNumber = Int(dateFormatter.date(from: tr.finishTime)!.timeIntervalSince1970-dateFormatter.date(from: tr.createTime)!.timeIntervalSince1970)
            SJCLbl.text = "用时：\(getHHMMSSFormSS(seconds: timeNumber))"
            rotal.text = "总题数：\(tr.count)"
            okLbl.text = "答对\(100-Int(tr.errorQuestions)!)题"
            errLbl.text = "答错\(tr.errorQuestions)题"
            
        }
        
    }
}
